package com.utils.basejava.JVM.OOM;

import java.util.ArrayList;
import java.util.List;

/**
 * GC 回收超时
 * JVM参数配置: -Xms10m -Xmx10m -XX:+PrintGCDetails -XX:MaxDirectMemorySize=5m
 * @author XR-8
 *
 */
public class GCOverheadDemo {

	public static void main(String[] args) {
		int i = 0;
		List<String> list = new ArrayList<String>();
		try {
			while(true) {
				list.add(String.valueOf(i++).intern());
			}
		} catch (Throwable e) {
			e.printStackTrace();
			throw e;
		}finally {
			System.out.println("****************i="+i);
			
		}
	}
}
